Learn R Programming

tractor.base (version 2.3.0)

path manipulation: Functions for file name and path manipulation

Description

Functions for expanding file paths, finding relative paths and ensuring that a file name has the required suffix.

Usage

ensureFileSuffix(fileName, suffix, strip = NULL)
expandFileName(fileName, base = getwd())
relativePath(path, referencePath)

Arguments

fileName
A character vector of file names.
suffix
A character vector of file suffixes, which will be recycled if shorter than fileName.
strip
A character vector of suffixes to remove before appending suffix. The intended suffix does not need to be given here, as the function will not append it if the specified file name already has the correct suffix.
base
If fileName is a relative path, this option gives the base directory which the path is relative to. If fileName is an absolute path, this argument is ignored.
path, referencePath
Character strings representing file paths.

Value

  • The ensureFileSuffix function returns the specified file names with the requested suffixes appended. expandFileName returns the full path to the specified file name, collapsing ".." elements if appropriate. relativePath returns the specified path, expressed relative to referencePath.

References

Please cite the following reference when using TractoR in your work:

J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18. http://www.jstatsoft.org/v44/i08/.

See Also

path.expand performs some of what expandFileName does.